Skip to main content

Repository

As mentioned in the previous section, we are using IbRepository for CRUD operations, the default implementation of this interface is IbRepositoryImpl.

image.png

Functions

FunctionDescription
getAll()Returns all the elements of the entity
getAll(SortingParams)Returns all the elements of the entity sorted based on the value of SortingParams
getAll(PagingParams)Returns all the elements of the entity sorted and paged based on the value of PagingParams
getById(Integer)Returns the element referenced by the given Id. If it does not exist, an exception will be thrown
remove(Object)Removes the entity
removeById(Integer)Removes the entity references by the given id
save(obj)Persist the entity

Parameter customization

You can create a child class of PagingParams and SortingParams and add fields to filter the results of the getAll functions.

This feature is based on the name of the field or the @Filter() annotation.

Whether you are using field names or the annotation the naming rules are simple.

  1. specify the SQL operator
  2. add underscore
  3. and specify the field name

eg:

EQ_name
ILIKE_name

If you do not specify the operator, equal operator will be used by default.

Either you do

private String EQ_name;
// or
@Filer("EQ_name")
private String whateverYouNameIt.

And if you want to ignore a field of your class, annotate with @IgnoreMapping

The available operators are

image.png